<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    div {
      border: solid;
    }

    .box1 {
      width: 600px;
      height: 600px;
      position: relative;
    }

    .box2 {
      font-size: 40px;
      width: 200px;
      height: 300px;
      position: absolute;
      /* (box1.width-box2.width)÷2 */
      top: 150px;
      left: 200px;
    }
  </style>
</head>

<body>
  <div class="box1">
    <div class="box2">box2</div>
  </div>
</body>

</html>